/*
 * @Author: hye0228 1261769443@qq.com
 * @Date: 2022-10-11 16:13:41
 * @LastEditors: hye0228 1261769443@qq.com
 * @LastEditTime: 2022-10-12 16:51:54
 * @FilePath: \v2.0.0\src\api\menu.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 *
 */
import request from "@/utils/request";

export function fetchTreeList() {
  return request({
    url: "/menu/v1/treeList",
    method: "get",
  });
}

export function fetchList(parentId, params) {
  return request({
    url: `/menu/v1/list/${parentId}`,
    method: "get",
    params: params,
  });
}

export function getMenu(id) {
  return request({
    url: `/menu/v1/getById/${id}`,
    method: "get",
  });
}

export function deleteMenu(id) {
  return request({
    url: `/menu/v1/delete/${id}`,
    method: "delete",
  });
}

export function createMenu(data) {
  return request({
    url: "/menu/v1/create",
    method: "post",
    data: data,
  });
}

export function updateMenu(id, data) {
  return request({
    url: `/menu/v1/update/${id}`,
    method: "put",
    data: data,
  });
}
